﻿CREATE TABLE [dbo].[arhConturiValuta] (
    [CodValuta]       SMALLINT        DEFAULT ((0)) NOT NULL,
    [Cont]            [dbo].[TipCont] NOT NULL,
    [CodUnitate]      SMALLINT        DEFAULT ((0)) NOT NULL,
    [DebitInitial]    DECIMAL (20, 2) DEFAULT ((0)) NOT NULL,
    [CreditInitial]   DECIMAL (20, 2) DEFAULT ((0)) NOT NULL,
    [DebitPrecedent]  DECIMAL (20, 2) DEFAULT ((0)) NOT NULL,
    [CreditPrecedent] DECIMAL (20, 2) DEFAULT ((0)) NOT NULL,
    [IdJurnal]        INT             DEFAULT ((0)) NOT NULL,
    [An]              SMALLINT        DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_arhConturiValuta] PRIMARY KEY CLUSTERED ([CodValuta] ASC, [Cont] ASC, [CodUnitate] ASC, [IdJurnal] ASC, [An] ASC),
    CONSTRAINT [FK_arhConturiValuta_arhConturi] FOREIGN KEY ([Cont], [CodUnitate], [An]) REFERENCES [dbo].[arhConturi] ([Cont], [CodUnitate], [An]),
    CONSTRAINT [FK_arhConturiValuta_Jurnale] FOREIGN KEY ([IdJurnal]) REFERENCES [dbo].[Jurnale] ([IDJurnal]),
    CONSTRAINT [FK_arhConturiValuta_Unitati] FOREIGN KEY ([CodUnitate]) REFERENCES [dbo].[Unitati] ([CodUnitate]),
    CONSTRAINT [FK_arhConturiValuta_Valuta] FOREIGN KEY ([CodValuta]) REFERENCES [dbo].[Valuta] ([CodValuta])
);

